Skip to content

gh-145713: fix: make bytearray.resize thread-safe#145714

Merged
kumaraditya303 merged 7 commits intopython:mainfrom
KowalskiThomas:kowalski/fix-make-bytearray-resize-thread-safe
Mar 11, 2026
Merged

gh-145713: fix: make bytearray.resize thread-safe#145714
kumaraditya303 merged 7 commits intopython:mainfrom
KowalskiThomas:kowalski/fix-make-bytearray-resize-thread-safe

Conversation

@KowalskiThomas
Copy link
Contributor

@KowalskiThomas KowalskiThomas commented Mar 9, 2026

Description

This PR is a fix for #145713; it adds a critical section annotation to the argument clinic input for bytearray.resize.

@colesbury
Copy link
Contributor

This looks good. The UBSan failures is unrelated to this PR (#142651).

Would you please add a regression test? The other free-threading related bytearray tests are in test_free_threading_bytearray in Lib/test/test_bytes.py.

@KowalskiThomas
Copy link
Contributor Author

KowalskiThomas commented Mar 10, 2026

Thanks for suggesting that -- I added a test! (And confirmed it does fail if I run it without my changes on a free-threaded build.)

@kumaraditya303 kumaraditya303 merged commit c3955e0 into python:main Mar 11, 2026
98 of 100 checks passed
@miss-islington-app
Copy link

Thanks @KowalskiThomas for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @KowalskiThomas and @kumaraditya303, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c3955e049fd5dbd3d92bc95fed4442964156293d 3.14

KowalskiThomas added a commit to KowalskiThomas/cpython that referenced this pull request Mar 11, 2026
…ython#145714)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
(cherry picked from commit c3955e0)
@bedevere-app
Copy link

bedevere-app bot commented Mar 11, 2026

GH-145799 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants